#@layout()

#define main()
<style type="text/css">
	.my-skin .layui-layer-btn a{
		background-color:#337ab7;
		border:1px solid #2e6da4;
	}
</style>
<div class="jfa-header-box" id="jfa-header-box">
    <div class="jfa-crumbs" id="jfa-crumbs">
        烘干炉温度控制参数
    </div>
    #include("/_view/common/_header_right.html")
</div>
<div class="jfa-content-box" id="jfa-content-box">
    <div class="jfa-content" id="jfa-content">
        <form class="form-horizontal margin-top-30"  id="stovingOvenForm" action="#(ctx)/admin/stovingOven/save" method="post" >
            <input type="hidden" name="stovingOven.id" value="#(stovingOven.id??)">
            <div class="form-group" >
                <label class="col-sm-4 control-label">连续空筐数量上限:</label>
                <div class="col-sm-4">
                    <input type="number" class="form-control" autocomplete="off" name="stovingOven.maxCount" value="#(stovingOven.max_count??)">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-4 control-label">升温点:</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control" autocomplete="off" name="stovingOven.riseTag" value="#(stovingOven.rise_tag??)">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-4 control-label">降温点:</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control" autocomplete="off" name="stovingOven.downTag" value="#(stovingOven.down_tag??)">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-4 control-label">是否启用:</label>
                <div class="col-sm-4">
                    <input type="checkbox" id="enable" class="switchery" data-for="stovingOvenEnable"  >
                    <input type="hidden" id="stovingOvenEnable" name="stovingOven.configStatus" value="#(stovingOven.config_status??)">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-4 control-label">更新时间:</label>
                <div class="col-sm-4">
                    <label class="control-label">#date(stovingOven.update_time??)</label>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-4 control-label">修改人:</label>
                <div class="col-sm-4">
                    <label class="control-label">#(stovingOven.changeUser??)</label>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-4 col-sm-8">
                    <input type="submit" class="btn btn-primary" value="保存">
                </div>
            </div>

        </form>
    </div>
</div>
<script type="text/javascript">


function setSwitchery(switchElement, checkedBool) {
    if((checkedBool && !switchElement.isChecked()) || (!checkedBool && switchElement.isChecked())) {
        switchElement.setPosition(true);
        switchElement.handleOnchange(true);
    }
}

var enable=new  Switchery($("#enable")[0], {size: 'small'})
$('#enable').change(function(){
    if($("#enable").prop("checked")){
        $("#stovingOvenEnable").val("1")
    }else{
        $("#stovingOvenEnable").val("0")
    }
});

#if(stovingOven.config_status==1)
setSwitchery(enable,true)
#else
setSwitchery(enable,false)
#end

$(document).ready(function() {
		$("#stovingOvenForm").ajaxForm({
			dataType: "json"
			, beforeSubmit: function(formData, jqForm, options) {}
			, success: function(ret) {
				if (ret.state == "ok") {
					location.href = "#(ctx)/admin/stovingOven";
				} else {
					showFailMsg(ret.msg);
				}
			}
			, error: function(ret) {alert(ret.statusText);}
			, complete: function(ret) {} 	      // 无论是 success 还是 error，最终都会被回调
		});
});
</script>
#end

#define css()
<link href="#(ctx)/assets/switchery/switchery.min.css" rel="stylesheet">
<style>
    .switchery-small{
        margin-top:5px;
    }
</style>
#end

#define js()
<script src="#(ctx)/assets/switchery/switchery.min.js"></script>
#end
